package crossbreed.presenters;

import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import crossbreed.models.ComparisonModel.IComparisonModel;
import crossbreed.views.IComparisonView;

public class ComparisonPresenter implements WindowListener, ComponentListener
{
	private IComparisonView view;
	private IComparisonModel model;
	
	public ComparisonPresenter(IComparisonModel model)
	{
		this.model = model;
	}
	
	public void setView(IComparisonView view)
	{
		this.view = view;
	}

	@Override
	public void windowActivated(WindowEvent e)
	{
	}

	@Override
	public void windowClosed(WindowEvent e)
	{
	}

	@Override
	public void windowClosing(WindowEvent e)
	{
		System.exit(0);
	}

	@Override
	public void windowDeactivated(WindowEvent e)
	{
	}

	@Override
	public void windowDeiconified(WindowEvent e)
	{
	}

	@Override
	public void windowIconified(WindowEvent e)
	{
	}

	@Override
	public void windowOpened(WindowEvent e)
	{
		model.createDiff();
	}

	@Override
	public void componentHidden(ComponentEvent e)
	{
	}

	@Override
	public void componentMoved(ComponentEvent e)
	{
	}

	@Override
	public void componentResized(ComponentEvent e)
	{
		view.setSplitterPosition();
	}

	@Override
	public void componentShown(ComponentEvent e)
	{
		view.setSplitterPosition();
	}
}
